import Main from './views/Main.vue';

export const loginRouter = {
  path: '/login',
  name: 'login',
  meta: {
    title: 'Login - 登录'
  },
  component: resolve => {
    require(['./views/AntdLogin.vue'], resolve);
  }
};

export const page401 = {
  path: '/*/*',
  name: 'error_401',
  meta: {
    title: '401-权限不足'
  },
  component: resolve => {
    require(['./errorPage/401.vue'], resolve);
  }
};

export const otherRouter = {
  path: '/',
  name: 'otherRouter',
  redirect: '/home',
  component: Main,
  children: [
    {
      path: 'home', title: '首页', name: 'home_index', component: resolve => {
        require(['./views/home/home.vue'], resolve);
      }
    },
    {
      path: 'ownSpace', title: '个人中心', name: 'ownspace_index', component: resolve => {
        require(['./views/own-space/own-space.vue'], resolve);
      }
    },
    {
      path: 'updateTips', title: '版本更新', name: 'updateTips_index', component: resolve => {
        require(['./views/home_components/updateTips.vue'], resolve);
      }
    },
    {
      path: 'employeeConfig', title: '雇主配置', name: 'employee_Config', component: resolve => {
        require(['./views/employee/component/edit.vue'], resolve);
      }
    }
  ]
};

export const appRouter = [
  {
    path: '/protocol',
    icon: 'ios-grid',
    title: '协议管理',
    name: 'search',
    component: Main,
    children: [
      {
        path: 'protocolInput',
        title: '协议录入',
        icon: 'ios-list-box',
        access: 11,
        meta: {
          name: '协议录入'
        },
        name: 'protocol_dealInput',
        component: resolve => {
          require(['./views/pages/protocol/protocolList/index.vue'], resolve);
        }
      },
      {
        path: 'protocolReview',
        title: '协议审核',
        icon: 'ios-apps',
        access: 12,
        meta: {
          name: '协议审核'
        },
        name: 'protocol_protocolReview',
        component: resolve => {
          require(['./views/pages/protocol/protocolReview/index.vue'], resolve);
        }
      },
      {
        path: 'protocolPool',
        title: '协议池',
        icon: 'ios-apps',
        access: 13,
        meta: {
          name: '协议池'
        },
        name: 'protocol_protocolPool',
        component: resolve => {
          require(['./views/pages/protocol/protocolPool/index.vue'], resolve);
        }
      }
    ]
  },
  {
    path: '/pay',
    icon: 'md-cafe',
    title: '支付管理',
    name: 'employer',
    component: Main,
    children: [
      {
        path: 'infoManage',
        title: '支付信息维护',
        icon: 'ios-contacts',
        access: 21,
        meta: {
          name: '支付信息维护'
        },
        name: 'pay_infoManage',
        component: resolve => {
          require(['./views/pages/pay/infoManage/index.vue'], resolve);
        }
      },
      {
        path: 'infoReview',
        title: '支付信息审核',
        icon: 'ios-contacts',
        access: 22,
        meta: {
          name: '支付信息审核'
        },
        name: 'pay_infoReview',
        component: resolve => {
          require(['./views/pages/pay/payReview/index.vue'], resolve);
        }
      }
    ]
  }
];

export const routers = [
  loginRouter,
  otherRouter,
  // page401,
  ...appRouter
];
